home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 131 / XENIATGM131.iso / Shareware / openOffice.org 641 / Windows / f_0017 / develop.xba < prev    next >
Extensible Markup Language  |  2001-11-22  |  17KB  |  505 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
  3.  <script:module xmlns:script="http://openoffice.org/2000/script" script:name="develop" script:language="StarBasic">REM  *****  BASIC  *****
  4. Option Explicit
  5.  
  6. Public oDBShapeList() as Object
  7. Public oTCShapeList() as Object
  8. Public oDBModelList() as Object
  9. 'Public oGroupShapeList() as Object
  10.  
  11. Public oGridShape as Object
  12. Public a as Integer
  13. Public StartA as Integer
  14. Public bIsFirstRun as Boolean
  15. Public bIsVeryFirstRun as Boolean
  16. Public bControlsareCreated as Boolean
  17. Public nDBRefHeight as Long
  18. Public nXTCPos&, nYTCPos&, nXDBPos&, nYDBPos&, nTCHeight&, nTCWidth&, nDBHeight&, nDBWidth&
  19. Public CurControlType as Integer
  20. Public CurFieldlength as Double
  21. Public CurFieldType as Integer
  22. Public CurFieldName as String
  23. Public CurControlName as String
  24. Dim iReduceWidth as Integer
  25.  
  26. Function PositionControls(Maxindex as Integer)
  27. Dim oTCModel as Object
  28. Dim oDBModel as Object
  29. Dim i as Integer
  30.     InitializePosSizes()
  31.     bIsFirstRun = True
  32.     bIsVeryFirstRun = True
  33.     a = 0
  34.     StartA = 0
  35.     nMaxRowY = 0
  36.     nSecMaxRowY = 0
  37.     If CurArrangement = cLeftJustified Or cTopJustified Then
  38.         oDialogModel.optAlign0.State = 1
  39.     End If
  40.     For i = 0 To MaxIndex
  41.         GetCurrentMetaValues(i)
  42. '        oGroupShapeList(i) = oDocument.CreateInstance("com.sun.star.drawing.GroupShape")
  43. '        oGroupShapeList(i).AnchorType = com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH
  44. '        oDrawPage.Add(oGroupShapeList(i))
  45.         oTCModel = InsertTextControl(i)
  46.         If CurFieldType = com.sun.star.sdbc.DataType.TIMESTAMP Then
  47.             InsertTimeStampShape(i)            
  48.         Else        
  49.             InsertDBControl(i)
  50.             bIsVeryFirstRun = False
  51.             oDBModelList(i).LabelControl = oTCModel
  52.         End If
  53.         ResetPosSizes(i)
  54. '        oGroupShapeList(i).Position = GetPoint(nXTCPos, nYTCPos)
  55. '        oGroupShapeList(i).Size = GetSize(nTCWidth + nDBWidth, nDBHeight)
  56.         oProgressbar.Value = i
  57.     Next i
  58.     ControlCaptionstoStandardLayout()
  59.     bControlsareCreated = True
  60. End Function
  61.  
  62.  
  63. Sub ResetPosSizes(LastIndex as Integer)
  64.     Select Case CurArrangement
  65.         Case cColumnarLeft
  66.             nYDBPos = nYDBPos  + nDBHeight + cVertDistance
  67.             If (nYDBPos > cYOffset + nFormHeight) Or (LastIndex = MaxIndex) Then
  68.                 RepositionColumnarLeftControls(LastIndex)
  69.                 nXTCPos = nMaxColRightX + 2 * cHoriDistance
  70.                 nXDBPos = nXTCPos + cHoriDistance + nMaxTCWidth
  71.                 nYDBPos = cYOffset
  72.                 bIsFirstRun = True
  73.                 StartA = LastIndex + 1
  74.                 a = 0
  75.             Else
  76.                 a = a + 1
  77.             End If
  78.             nYTCPos = nYDBPos + LABELDIFFHEIGHT
  79.         Case cColumnarTop
  80.             nYTCPos = nYDBPos + nDBHeight + cVertDistance
  81.             If nYTCPos > cYOffset + nFormHeight Then
  82.                 nXDBPos = nMaxColRightX + cHoriDistance
  83.                 nXTCPos = nMaxColRightX + cHoriDistance
  84.                 nYDBPos = cYOffset + nTCHeight + cVertDistance
  85.                 nYTCPos = cYOffset
  86.                 bIsFirstRun = True
  87.                 StartA = LastIndex + 1
  88.                 a = 0
  89.             Else
  90.                 a = a + 1
  91.             End If
  92.         Case cLeftJustified,cTopJustified
  93.             If nMaxColRightX > cXOffset + nFormWidth Then
  94.                 Dim nOldYTCPos as Long
  95.                 nOldYTCPos = nYTCPos
  96.                 CheckJustifiedPosition()
  97.             Else
  98.                 nXTCPos = nMaxColRightX + CHoriDistance
  99.             End If
  100.             a = a + 1                
  101.     End Select
  102. End Sub
  103.  
  104.  
  105. Sub    RepositionColumnarLeftControls(LastIndex as Integer)
  106. Dim aSize As New com.sun.star.awt.Size
  107. Dim aPoint As New com.sun.star.awt.Point
  108. Dim i as Integer
  109.     aSize = GetSize(nMaxTCWidth, nTCHeight)
  110.     bIsFirstRun = True
  111.     For i = StartA To LastIndex
  112.         oLocTextShape.Size = aSize
  113.         If i = StartA Then
  114.             nXTCPos = oTCShapeList(i).Position.X
  115.             nXDBPos = nXTCPos + nMaxTCWidth  + cHoriDistance
  116.         End If
  117.         ResetDBShape(oDBShapeList(i), nXDBPos)
  118.         CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  119.     Next i
  120. End Sub
  121.  
  122.  
  123. Sub ResetDBShape(oLocDBShape as Object, iXPos as Long)
  124. Dim aSize As New com.sun.star.awt.Size
  125. Dim aPoint As New com.sun.star.awt.Point
  126.     nYDBPos = oLocDBShape.Position.Y
  127.     nDBWidth = oLocDBShape.Size.Width
  128.     nDBHeight = oLocDBShape.Size.Height
  129.     aPoint = GetPoint(iXPos,nYDBPos)
  130.     oLocDBShape.SetPosition(aPoint)
  131. End Sub
  132.  
  133.  
  134. Sub InitializePosSizes()
  135.     nXTCPos = cXOffset
  136.     nYTCPos = cYOffset + LABELDIFFHEIGHT
  137.     nTCWidth = 2000
  138.     nDBWidth = 2000
  139.     nDBHeight = nDBRefHeight
  140.     iReduceWidth = 0
  141.     Select Case CurArrangement
  142.         Case cColumnarLeft, cLeftJustified
  143.             nXDBPos = cXOffset + 3050
  144.             nYDBPos = cYOffset
  145.         Case cColumnarTop, cTopJustified
  146.             nXDBPos = cXOffset
  147.     End Select
  148. End Sub
  149.  
  150.  
  151. Function InsertTextControl(i as Integer) as Object
  152. Dim oShape as Object
  153. Dim oModel as Object
  154. Dim aPoint as New com.sun.star.awt.Point
  155. Dim aSize As New com.sun.star.awt.Size
  156.     If bControlsareCreated Then
  157.         Set oShape = oTCShapeList(i)
  158.         Set oModel = oShape.GetControl
  159.         If CurArrangement = cLeftJustified Then
  160.             nTCWidth = GetPreferredWidth(oModel, True, CurFieldname)
  161.         Else
  162.             nTCWidth = oShape.Size.Width
  163.         End If
  164.         oShape.Position = GetPoint(nXTCPos, nYTCPos)
  165.         If CurArrangement = cColumnarTop Then
  166.             oModel.Align = com.sun.star.awt.TextAlign.LEFT
  167.         End If
  168.     Else
  169.         oModel = CreateUnoService(oModelService(cLabel))
  170. ' Todo: According to FS this handling should be verified. I should not rely on the shape to create a model on its
  171. ' own. therefor the model should be inserted before the shape
  172. '        oDBForm.InsertByName(oModel.Name, oModel)
  173.         aPoint = GetPoint(nXTCPos, nYTCPos)
  174.         aSize = GetSize(nTCWidth,nTCHeight)
  175.         Set oShape = InsertControl(oDrawPage, oModel, aPoint, aSize)
  176.         Set oTCShapeList(i)= oShape
  177.         If bIsVeryFirstRun Then
  178.             If CurArrangement = cColumnarTop Then
  179.                 nYDBPos = nYTCPos + nTCHeight
  180.             End If
  181.         End If
  182.         nTCWidth = GetPreferredWidth(oModel, True, CurFieldname)
  183.     End If
  184.     If CurArrangement = cColumnarLeft Then
  185.         ' Note This If Sequence must be called before retrieving the outer Points
  186.         If bIsFirstRun Then
  187.             nMaxTCWidth = nTCWidth
  188.             bIsFirstRun = False
  189.         ElseIf nTCWidth > nMaxTCWidth Then
  190.             nMaxTCWidth = nTCWidth
  191.         End If
  192.     End If
  193.     CheckOuterPoints(oShape.Position.X, nTCWidth, nYTCPos, nTCHeight, False)
  194.     Select Case CurArrangement
  195.         Case cLeftJustified
  196.             nXDBPos = nMaxColRightX
  197.         Case cColumnarTop,cTopJustified
  198.             oModel.Align = com.sun.star.awt.TextAlign.LEFT
  199.             nXDBPos = nXTCPos
  200.             nYDBPos = nYTCPos + nTCHeight
  201.             If CurFieldLength = 20 And nDBWidth > 2 * nTCWidth Then
  202.                 iReduceWidth = iReduceWidth + 1
  203.             End If 
  204.     End Select    
  205.     oShape.SetSize(GetSize(nTCWidth,nTCHeight))
  206.     InsertTextControl = oModel
  207. End Function
  208.  
  209.  
  210. Sub InsertDBControl(i as Integer)
  211. Dim aPoint as New com.sun.star.awt.Point
  212. Dim aSize As New com.sun.star.awt.Size
  213. Dim oControl as Object
  214. Dim iColRightX as Long
  215.  
  216.     aPoint = GetPoint(nXDBPos, nYDBPos)
  217.     If bControlsAreCreated Then
  218.         oDBShapeList(i).Position = aPoint
  219.     Else
  220.         oDBModelList(i) = CreateUnoService(oModelService(CurControlType))
  221.         oDBShapeList(i) = InsertControl(oDrawPage, oDBModelList(i), aPoint, aSize)        
  222.         SetNumerics(oDBModelList(i), CurFieldType)
  223.         If CurControlType = cCheckBox Then
  224.             oDBModelList(i).Label = ""
  225.         End If
  226.         ' Todo: According to FS this handling should be verified. I should not rely on the shape to create a model on its
  227.         ' own. therefor the model should be inserted before the shape
  228.         ' oDBForm.InsertByName(oDBModel.Name, oDBModel)
  229.         oDBModelList(i).DataField = CurFieldName
  230.     End If
  231.     nDBHeight = GetDBHeight(oDBModelList(i))
  232.     nDBWidth = GetPreferredWidth(oDBModelList(i),True)
  233.     aSize = GetSize(nDBWidth,nDBHeight)
  234.     oDBShapeList(i).SetSize(aSize)
  235.     CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  236. End Sub
  237.  
  238.  
  239. Function InsertTimeStampShape(i as Integer) as Object
  240. Dim oDateModel as Object
  241. Dim oTimeModel as Object
  242. Dim oDateShape as Object
  243. Dim oTimeShape as Object
  244. Dim oDateTimeShape as Object
  245. Dim aPoint as New com.sun.star.awt.Point
  246. Dim aSize as New com.sun.star.awt.Size
  247. Dim nDateWidth as Long
  248. Dim nTimeWidth as Long
  249. Dim oGroupShape as Object
  250.     aPoint = GetPoint(nXDBPos, nYDBPos)
  251.     If bControlsAreCreated Then
  252.         oDBShapeList(i).Position = aPoint
  253.         nDBWidth = oDBShapeList(i).Size.Width
  254.         nDBHeight = oDBShapeList(i).Size.Height
  255.     Else        
  256.         oGroupShape = oDocument.CreateInstance("com.sun.star.drawing.GroupShape")
  257.         oGroupShape.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH
  258.         oDrawPage.Add(oGroupShape)
  259.         CurFieldType = com.sun.star.sdbc.DataType.DATE
  260.         oDateModel = CreateUnoService("com.sun.star.form.component.DateField")
  261.         oDateModel.DataField = CurFieldName
  262.         oDateShape = InsertControl(oGroupShape, oDateModel, aPoint, aSize)
  263.         SetNumerics(oDateModel, CurFieldType)
  264.         nDBHeight = GetDBHeight(oDateModel)
  265.         nDateWidth = GetPreferredWidth(oDateModel,True)
  266.         aSize = GetSize(nDateWidth,nDBHeight)
  267.         oDateShape.SetSize(aSize)
  268.  
  269.         CurFieldType = com.sun.star.sdbc.DataType.TIME
  270.         oTimeModel = CreateUnoService("com.sun.star.form.component.TimeField")
  271.         oTimeModel.DataField = CurFieldName
  272.         oTimeShape = InsertControl(oGroupShape, oTimeModel, aPoint, aSize)
  273.         oTimeShape.Position = GetPoint(nXDBPos + 10 + nDateWidth,nYDBPos)
  274.         nTimeWidth = GetPreferredWidth(oTimeModel)
  275.         aSize = GetSize(nTimeWidth,nDBHeight)
  276.         oTimeShape.SetSize(aSize)
  277.         nDBWidth = nDateWidth + nTimeWidth + 10
  278.         oGroupShape.Position = aPoint
  279.         oGroupShape.Size = GetSize(nDBWidth + 10 + nTimeWidth, nDBHeight)
  280.         Set oDBShapeList(i)= oGroupShape
  281.     End If
  282.     CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  283.     InsertTimeStampShape() = oDBShapeList(i)    
  284. End Function
  285.  
  286.  
  287. Sub CheckJustifiedPosition()
  288. Dim nLeftDist as Long
  289. Dim nRightDist as Long
  290. Dim oLocDBShape as Object
  291. Dim oLocTextShape as Object
  292. Dim nBaseWidth as Long
  293.     nBaseWidth = nFormWidth + cXOffset
  294.     nLeftDist = nMaxColRightX - nBaseWidth
  295.     nRightDist = nBaseWidth - nXTCPos + cHoriDistance
  296.     If nLeftDist < 0.5 * nRightDist and iReduceWidth > 2 Then
  297.         ' Fieldwidths in the line can be made smaller
  298.         AdjustLineWidth(StartA, a, nLeftDist, - 1)
  299.         If CurArrangement = cLeftjustified Then
  300.             nYDBPos = nMaxRowY + cVertDistance
  301.             nYTCPos = nYDBPos + LABELDIFFHEIGHT
  302.             nXTCPos = cXOffset
  303.         Else
  304.             nYTCPos = nMaxRowY + cVertDistance
  305.             nYDBPos = nYTCPos + nTCHeight
  306.             nXTCPos = cXOffset
  307.             nXDBPos = cXOffset
  308.         End If
  309.         bIsFirstRun = True
  310.         StartA = a + 1
  311.     Else
  312.         Set oLocDBShape = oDBShapeList(a)
  313.         Set oLocTextShape = oTCShapeList(a)
  314.         If CurArrangement = cLeftJustified Then
  315.             If nYDBPos + nDBHeight = nMaxRowY Then
  316.                 ' The last Control was the highes in the row
  317.                 nYDBPos = nSecMaxRowY + cVertDistance
  318.             Else
  319.                 nYDBPos = nMaxRowY + cVertDistance
  320.             End If
  321.             nYTCPos = nYDBPos + LABELDIFFHEIGHT
  322.             nXDBPos = cXOffset + nTCWidth
  323.             oLocTextShape.Position = GetPoint(cXOffset, nYTCPos)
  324.             oLocDBShape.Position = GetPoint(nXDBPos, nYDBPos)
  325.             ' PosSizes for the next two Controls
  326.             nXTCPos = oLocDBShape.Position.X + oLocDBShape.Size.Width + cHoriDistance
  327.             bIsFirstRun = True
  328.             CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  329.             nXDBPos = nMaxColRightX + cHoriDistance
  330.         Else        ' cTopJustified
  331.             If nYDBPos + nDBHeight = nMaxRowY Then
  332.                 ' The last Control was the highest in the row
  333.                 nYTCPos = nSecMaxRowY + cVertDistance
  334.             Else
  335.                 nYTCPos = nMaxRowY + cVertDistance
  336.             End If
  337.             nYDBPos = nYTCPOS + nTCHeight
  338.             nXDBPos = cXOffset
  339.             nXTCPos = cXOffset
  340.             oLocTextShape.Position = GetPoint(cXOffset, nYTCPos)
  341.             oLocDBShape.Position = GetPoint(cXOffset, nYDBPos)
  342.             bIsFirstRun = True
  343.             If nDBWidth > nTCWidth Then
  344.                 CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  345.             Else
  346.                 CheckOuterPoints(nXDBPos, nTCWidth, nYDBPos, nDBHeight, True)
  347.             End If
  348.             nXTCPos = nMaxColRightX + cHoriDistance
  349.             nXDBPos = nXTCPos
  350.         End If
  351.         AdjustLineWidth(StartA, a-1, nRightDist, 1)
  352.         StartA = a
  353.      End If
  354.      iReduceWidth = 0
  355. End Sub
  356.  
  357.  
  358. Sub AdjustLineWidth(StartIndex as Integer, EndIndex as Integer, nDist as Long, Widthfactor as Integer)
  359. Dim i as Integer
  360. Dim oLocDBShape as Object
  361. Dim oLocTCShape as Object
  362. Dim CorrWidth as Integer
  363. Dim bAdjustPos as Boolean
  364. Dim iLocTCPosX as Long
  365. Dim iLocDBPosX as Long
  366. Dim ShapeCount as Integer
  367. ' Todo: Hier muss ber├╝cksichtigt werden, dass gewisse Widths z.B f├╝r numerische Controls nicht pl├╢tzlich zu klein werden
  368. ' Am besten werden nur TextControls gestaucht, so dass vorher geschaut werden muss, ob ├╝berhaupt TextControls vorhanden
  369. ' sind
  370.     If WidthFactor > 0 Then
  371.         ShapeCount = EndIndex-StartIndex + 1
  372.     Else
  373.         ShapeCount = iReduceWidth
  374.     End If
  375.     CorrWidth = (nDist)/ShapeCount  
  376.     bAdjustPos = False
  377.     iLocTCPosX = cXOffset
  378.     For i = StartIndex To EndIndex
  379.         Set oLocDBShape = oDBShapeList(i)
  380.         Set oLocTCShape = oTCShapeList(i)
  381.         If bAdjustPos Then
  382.             oLocTCShape.Position = GetPoint(iLocTCPosX, oLocTCShape.Position.Y)
  383.             If CurArrangement = cLeftJustified Then
  384.                 iLocDBPosX = oLocTCShape.Position.X + oLocTCShape.Size.Width
  385.                 oLocDBShape.Position = GetPoint(iLocDBPosX, oLocDBShape.Position.Y)
  386.             Else
  387.                 oLocDBShape.Position = GetPoint(iLocTCPosX, oLocTCShape.Position.Y + nTCHeight)
  388.             End If
  389.         Else
  390.             bAdjustPos = True
  391.         End If
  392.         If CDbl(FieldMetaValues(i,1)) > 20 or WidthFactor > 0 Then
  393.             oLocDBShape.Size = GetSize(oLocDBShape.Size.Width + WidthFactor * CorrWidth, oLocDBShape.Size.Height)
  394.         End If
  395.         iLocTCPosX = oLocDBShape.Position.X + oLocDBShape.Size.Width + cHoriDistance
  396.         If CurArrangement = cTopJustified Then
  397.             If oLocTCShape.Size.Width > oLocDBShape.Size.Width Then
  398.                 iLocTCPosX = oLocDBShape.Position.X + oLocTCShape.Size.Width + cHoriDistance
  399.             End If
  400.         End If
  401.     Next i
  402. End Sub
  403.  
  404.  
  405. Sub CheckOuterPoints(nXPos, nWidth, nYPos, nHeight, bIsDBField as Boolean)
  406. Dim nColRightX as Long
  407. Dim nRowY as Long
  408. Dim nOldMaxRowY as Long
  409.     If CurArrangement = cLeftJustified Or CurArrangement = cTopJustified Then
  410.         If bIsDBField Then
  411.             ' Only at DBControls you can measure the Value of nMaxRowY
  412.             If bIsFirstRun Then
  413.                 nMaxRowY = nYPos + nHeight
  414.                 nSecMaxRowY = nMaxRowY
  415.             Else
  416.                 nRowY = nYPos + nHeight
  417.                 If nRowY >= nMaxRowY Then
  418.                     nOldMaxRowY = nMaxRowY
  419.                     nSecMaxRowY = nOldMaxRowY
  420.                     nMaxRowY = nRowY
  421.                 End If
  422.             End If
  423.         End If 
  424.     End If
  425.     ' Find the outer right point
  426.     If bIsFirstRun Then
  427.         nMaxColRightX = nXPos + nWidth
  428.         bIsFirstRun = False
  429.     Else
  430.         nColRightX = nXPos + nWidth
  431.         If nColRightX > nMaxColRightX Then
  432.             nMaxColRightX = nColRightX
  433.         End If
  434.     End If
  435. End Sub
  436.  
  437.  
  438. Function PositionGridControl(MaxIndex as Integer)
  439. Dim oControl as Object
  440. Dim n as Integer
  441. Dim oColumn as Object
  442. Dim aPoint as New com.sun.star.awt.Point
  443. Dim aSize as New com.sun.star.awt.Size
  444. '    oDocument.LockControllers()
  445.     If bControlsareCreated Then
  446.         ShapesToNirwana()
  447.     End If
  448.     oGridModel = CreateUnoService(oModelService(cGridControl))
  449.     oGridModel.Name = "Grid1"
  450.     aPoint = GetPoint(cXOffset, cYOffset)
  451.     aSize = GetSize(nFormWidth, nFormHeight)
  452.     oDBForm.InsertByName (oGridModel.Name, oGridModel)
  453.     oGridShape = InsertControl(oDrawPage, oGridModel, aPoint, aSize)
  454.     For n = 0 to MaxIndex
  455.         GetCurrentMetaValues(n)
  456.         If CurFieldType = com.sun.star.sdbc.DataType.TIMESTAMP Then
  457.             oColumn = SetupGridColumn(oGridModel,"DateField", False, com.sun.star.sdbc.DataType.DATE, CurFieldName & " " & sDateAppendix)
  458.             oColumn = SetupGridColumn(oGridModel,"TimeField", False, com.sun.star.sdbc.DataType.TIME, CurFieldName & " " & sTimeAppendix)
  459.         Else
  460.             If CurControlType = cImageControl Then
  461.                 oColumn = SetupGridColumn(oGridModel,"TextField", True, CurFieldType, CurFieldName)
  462.             Else
  463.                 oColumn = SetupGridColumn(oGridModel, CurControlName, False, CurFieldType, CurFieldName)
  464.             End If
  465.         End If
  466.         oProgressbar.Value = n
  467.     next n
  468. '    oDocument.UnlockControllers()    
  469. End Function
  470.  
  471.  
  472. Function SetupGridColumn(oGridModel as Object, ControlName as String, bHidden as Boolean, iLocFieldType as Integer, ColName as String) as Object
  473. Dim oColumn as Object
  474.     CurControlName = ControlName
  475.     oColumn = oGridModel.CreateColumn(CurControlName)
  476.     oColumn.Name = CalcUniqueContentName(oGridModel, CurControlName)
  477.     oColumn.Hidden = bHidden
  478.     SetNumerics(oColumn, iLocFieldType)
  479.     oColumn.DataField = CurFieldName
  480.     oColumn.Label = ColName 
  481.     oColumn.Width = 0     ' Width of column is adjusted to Columname
  482.     oGridModel.insertByName(oColumn.Name, oColumn)
  483. End Function        
  484.  
  485.  
  486. Sub ControlCaptionstoStandardLayout()
  487. Dim i as Integer
  488. Dim iBorderType as Integer
  489. Dim oCurModel as Object
  490. Dim oStyle as Object
  491. Dim iStandardColor as Long
  492.     If CurArrangement <> cTabled Then
  493.         oStyle = oDocument.StyleFamilies.GetByName("ParagraphStyles").GetByName("Standard")
  494.         iStandardColor = oStyle.CharColor
  495.         For i = 0 To MaxIndex
  496.             oCurModel = oTCShapeList(i).GetControl
  497.             If i = 0 Then
  498.                 If oCurModel.TextColor = iStandardColor Then
  499.                     Exit Sub
  500.                 End If
  501.             End If
  502.             oCurModel.TextColor = iStandardColor
  503.         Next i
  504.     End If
  505. End Sub</script:module>